package com.sunwhite.deeplearning.demo02;

import org.neuroph.core.NeuralNetwork;
import org.neuroph.core.data.DataSet;
import org.neuroph.core.data.DataSetRow;
import org.neuroph.core.events.LearningEvent;
import org.neuroph.core.events.LearningEventListener;
import org.neuroph.core.learning.LearningRule;

public class Main implements LearningEventListener {
    public static void main(String[] args) {
        //锻炼感知机数据
        DataSet trainingSet = new DataSet(2,1);
        trainingSet.addRow(new DataSetRow(new double[]{0,0},new double[]{0}));
        trainingSet.addRow(new DataSetRow(new double[]{0,1},new double[]{0}));
        trainingSet.addRow(new DataSetRow(new double[]{1,0},new double[]{0}));
        trainingSet.addRow(new DataSetRow(new double[]{1,1},new double[]{1}));
        //建立一个感知机定义输入刺激是两个，感知机输出是一个，这里调用我们创建的简单感知机
        NeuralNetwork netWork = new NetWork();
        LearningRule learningRule = netWork.getLearningRule();
//        learningRule.addListener();
        //开始学习训练数据集
        learningRule.learn(trainingSet);
        //测试感知机是否
        System.out.println("测试感知机输出结果是否正确");
    }


    @Override
    public void handleLearningEvent(LearningEvent learningEvent) {

    }
}
